package com.esri.core.renderer;

import com.esri.core.internal.util.d;
import java.io.StringWriter;
import org.codehaus.jackson.JsonGenerator;

/* loaded from: classes.dex */
public class ColormapRenderer implements RasterRenderer {
    private static final String a = "colormap";
    private Colormap b;

    public ColormapRenderer() {
    }

    public ColormapRenderer(Colormap colormap) {
        this.b = colormap;
    }

    @Override // com.esri.core.renderer.RasterRenderer
    public String toJson() throws Exception {
        StringWriter stringWriter = new StringWriter();
        JsonGenerator a2 = d.a(stringWriter);
        a2.writeStartObject();
        toJson(a2);
        a2.writeEndObject();
        a2.close();
        return stringWriter.toString();
    }

    protected void toJson(JsonGenerator jsonGenerator) throws Exception {
        d.a(jsonGenerator, "type", a);
        Colormap colormap = this.b;
        if (colormap != null) {
            colormap.toJson(jsonGenerator);
        }
    }

    public Colormap getColormap() {
        return this.b;
    }

    public void setColormap(Colormap colormap) {
        this.b = colormap;
    }
}
